//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "management\fn_loadJIPVariables.sqf"
#include <tmf_constants.h>
#include <tmf_macros.h>

private ["_instances","_instance_id","_variables","_x","_key","_val","_count"];
TRACE_1("Start",_this);
TMFPROFILERSTART;

_count = 0;
_instances = JIPGETVAR(QGVAR(MISSION_INSTANCES),[]);
TRACE_1("Instances",_instances);
{
	_instance_id = _x;
	TRACE_1("Instance ID",_instance_id);
	_variables = JIPGETVAR(_instance_id,(call FFUNC(hashEmpty)));
	{
		_key = _x;
		_val = [_variables, _key, nil,THIS_FILE] call FFUNC(hashGet);
		TRACE_2("JIP",_key,_val);
		[_instance_id, _key, _val] call FFUNC(setMissionVar);
		_count = _count + 1;
	} foreach ([_variables] call FFUNC(hashKeys));
}foreach _instances;

_message = format["Client Initialized: %1 (%2), Jip Vars: %3",name player, getPlayerUID player, _count];
NETLOG(_message);
TLOG(_message);

TRACE_2("End",_count,_instances);
TMFPROFILERSTOP;
